import fetch from '@/utils/fetch'

export function apiGetAcceptOrderList (listQuery) {
  return fetch({
    url: '/api/v1/factory/receive/list',
    method: 'GET',
    params: listQuery
  })
}

export function apiGetFactoryReturnList (listQuery) {
  return fetch({
    url: '/api/v1/factory/return/list',
    method: 'GET',
    params: listQuery
  })
}

export function apiGetReturnFactoryDevices (listQuery) {
  return fetch({
    url: '/api/v1/factory/receive/deviceList',
    method: 'GET',
    params: listQuery
  })
}

export function apiGetDevices (listQuery) {
  return fetch({
    url: '/api/v1/factory/repair/devices',
    method: 'GET',
    params: listQuery
  })
}

// 获取工厂待维修一览
export function apiGetDevicesRepairList (listQuery) {
  return fetch({
    url: '/api/v1/factory/repair/list',
    method: 'GET',
    params: listQuery
  })
}
// 获取工厂已维修一览
export function apiGetFinishRepairList (listQuery) {
  return fetch({
    url: '/api/v1/factory/repair/finish/list',
    method: 'GET',
    params: listQuery
  })
}
// 工厂收机
export function apiPostFactoryDeviceReceive (confirmDto) {
  return fetch({
    url: '/api/v1/factory/receive',
    method: 'PUT',
    data: confirmDto
  })
}

// 工厂维修提交维修工单
export function apiPostFactoryRepair (listQuery) {
  return fetch({
    url: '/api/v1/factory/repair',
    method: 'post',
    data: listQuery
  })
}

// 工厂返回获取返还信息
export function apiGetLogisticInfo (batch) {
  return fetch({
    url: '/api/v1/factory/return/logistic',
    method: 'get',
    params: {
      batch: batch
    }
  })
}

// 工厂物流返回
export function apiPostFactoryReturn (listQuery) {
  return fetch({
    url: '/api/v1/factory/return',
    method: 'post',
    data: listQuery
  })
}

// 按批次获取返回id
export function apiGetReturnBatchList (listQuery) {
  return fetch({
    url: '/api/v1/factory/return/batch/list',
    method: 'GET',
    params: listQuery
  })
}

// 获取工厂已返还一览
export function apiGetReturnDeviceFinishList (listQuery) {
  return fetch({
    url: '/api/v1/factory/return/finish/list',
    method: 'GET',
    params: listQuery
  })
}

// 获取工厂维修报废一览
export function apiGetFactoryScrapList (listQuery) {
  return fetch({
    url: '/api/v1/factory/repair/reject',
    method: 'GET',
    params: listQuery
  })
}

// 获取工厂报废设备详情
export function apiGetFactoryScrapDetail (id) {
  return fetch({
    url: '/api/v1/factory/repair/reject/detail',
    method: 'GET',
    params: {
      repairId: id
    }
  })
}

// 获取工厂设备一览信息
export function apiGetFactoryDevice (listQuery) {
  return fetch({
    url: '/api/v1/factory/device/list',
    method: 'GET',
    params: listQuery
  })
}

// 获取工厂设备一览信息
export function apiGetFactoryDeviceDetail (listQuery) {
  return fetch({
    url: '/api/v1/factory/device/detail/list',
    method: 'GET',
    params: listQuery
  })
}

// 工厂拒收设备
export function apiPostFactoryDeviceRefuse (listQuery) {
  return fetch({
    url: '/api/v1/factory/receive/refuse',
    method: 'post',
    data: listQuery
  })
}

export function apiExport(listQuery) {
  return fetch({
    url: '/api/v1/factory/repair/export/finish',
    method: 'post',
    data: listQuery,
    responseType: 'arraybuffer'
  })
}

export function apiUnRepairExport(listQuery) {
  return fetch({
    url: '/api/v1/factory/repair/export/unRepair',
    method: 'post',
    data: listQuery,
    responseType: 'arraybuffer'
  })
}

export function apiReturnExport(listQuery) {
  return fetch({
    url: '/api/v1/factory/return/export/unReturn',
    method: 'post',
    data: listQuery,
    responseType: 'arraybuffer'
  })
}
export function apiFinishReturnExport(listQuery) {
  return fetch({
    url: '/api/v1/factory/return/export/finishReturn',
    method: 'post',
    data: listQuery,
    responseType: 'arraybuffer'
  })
}
// 获取工厂批次一览
export function apiGetFactoryBatchInfo (listQuery) {
  return fetch({
    url: '/api/v1/factory/batch/list',
    method: 'GET',
    params: listQuery
  })
}

// 获取批次内机器详情一览
export function apiGetBatchDeviceInfo (listQuery) {
  return fetch({
    url: '/api/v1/factory/batch/info',
    method: 'GET',
    params: listQuery
  })
}

// 获取批次内机器未返还详情一览
export function apiGetBatchUnreturnDevice (listQuery) {
  return fetch({
    url: '/api/v1/factory/batch/unreturn',
    method: 'GET',
    params: listQuery
  })
}

// 获取批次内机器已返还详情一览
export function apiGetBatchReturnedDevice (listQuery) {
  return fetch({
    url: '/api/v1/factory/batch/returned',
    method: 'GET',
    params: listQuery
  })
}
// 批量维修设备
export function apiPostBatchRepair (listQuery) {
  return fetch({
    url: '/api/v1/factory/repair/batch',
    method: 'POST',
    data: listQuery
  })
}
// 打印工厂返还通知单
export function apiPrintFactoryReturnOrder (listQuery) {
  return fetch({
    url: '/api/v1/factory/return/export/returnPoint',
    method: 'POST',
    data: listQuery,
    responseType: 'arraybuffer'
  })
}

// 工厂批次信息一览导出
export function apiGetFactoryOverviewListExport (listQuery) {
  return fetch({
    url: '/api/v1/factory/batch/export',
    method: 'POSt',
    params: listQuery,
    responseType: 'arraybuffer'
  })
}

// 完整工厂批量维修模板下载
export function apiGetFactoryBatchRepairTemplate (listQuery) {
  return fetch({
    url: '/api/v1/factory/repair/export/complete',
    method: 'POST',
    data: listQuery,
    responseType: 'arraybuffer'
  })
}

// 获取工厂报废中一览
export function apiGetScrapingList (listQuery) {
  return fetch({
    url: '/api/v1/factory/repair/scraping/list',
    method: 'GET',
    params: listQuery
  })
}

// 报废中补充报废附件
export function apiUploadScrapingFile (listQuery) {
  return fetch({
    url: '/api/v1/factory/repair/scraping/file',
    method: 'POST',
    data: listQuery
  })
}

// 工厂收机导出
export function apiAcceptExport (listQuery) {
  return fetch({
    url: '/api/v1/factory/receive/export',
    method: 'POST',
    params: listQuery,
    responseType: 'arraybuffer'
  })
}
